import java.util.LinkedList;
import java.util.List;

public class Topic {
	private String title;
	private String description;
	private Profile profile;
	private List<Reply> replies;

	public Topic(Profile profile, String title, String description) {
		this.title = title;
		this.description = description;
		this.profile = profile;
		replies = new LinkedList<Reply>();
	}
	
	public void replay(Reply reply){
		replies.add(reply);
	}
	
	public void removeReplay(Reply reply){
		for (int i = 0; i < replies.size(); i++) {
			if (replies.get(i).match(reply)){
				replies.remove(i);
			}
		}
	}
    
	public String getTitle() {
		return title;
	}

	public String getDescription() {
		return description;
	}
	
	public List<Reply> getReplies() {
		return replies;
	}
	
	public Profile getProfile() {
		return profile;
	}

	public boolean match(Topic topic){
		if (!profile.equals(profile.getProfiles()))
			return false;
		return true;
	}

}
